<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center talk_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub talk_fd0_0'>
					<view class='flex flex-wrap align-center talk_fd0_0_c0'>
						<text class='fu-iconfont2  talk_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back"
							data-url="1">&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='talk_fd0_0_c1_c0'>{{$t('主题讨论')}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end talk_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout talk_flex_1">
				<template v-for='(item,key0) in dataList'>
					<view class='flex flex-direction flex-wrap align-stretch talk_fd1_0'
						@tap.stop="queryEssayFunc(item.aid,item.subject,item.topic_status)" :key='item.aid'>
						<view class='flex flex-wrap align-stretch flex-sub'>
							<image class='talk_fd1_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"1615.png"'></image>
							<text class="flex-sub fd0_0_ben">{{item.subject}}</text>
						</view>
						<template v-for='(child,key1) in answerList'>
							<view class='flex flex-wrap align-center talk_fd1_0_c1'
								v-if=" child.topicdiscussion_id==item.aid" :key='item.aid'>
								<text class='talk_fd1_0_c1_c0'>{{child.answer}}</text>
							</view>
						</template>
					</view>
				</template>
			</view>
			<!---flex布局flex布局结束-->
		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"dataList": [],
				"answer": {
					"aid": "",
					"topicdiscussion_subject": "",
					"answer": "",
					"comment": "",
					"review_status": "",
					"topicdiscussion_id": ""
				},
				"answerList": [],
				"teachin": ""
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			console.log(options);
			let {
				teachin
			} = options
			if (teachin !== undefined) this.teachin = teachin

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.getmc6f526b296436Func()

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//检验是否提交文章
			async queryEssayFunc(aid, subject, topic_status) {
				//判断是否开启讨论
				if (topic_status == 2) {
					this.$message.info('讨论已结束')
					return
				} else if (topic_status == 0) {
					this.$message.info('讨论未开始')
					return
				}

				let datadataMessage = await this.$api.get(global.apiUrls.post672c65a249bae, {
					topicdiscussion_id: aid
				});

				if (datadataMessage.data.code != 1) {
					this.$message.info(datadataMessage.data.msg);
					return
				}
				let infodataMessage = datadataMessage.data;
				this.dataMessage = infodataMessage.data
				if (this.dataMessage == '') {
					this.$urouter.navigateTo(
						`/pages/course/subTalk/subTalk?aid=${aid}&name=${subject}&teachin=${this.teachin}`)

				}
			},
			//APP接口-获取主题讨论问题列表
			async getmc6f526b296436Func() {
				//请求方法
				//数据验证

				let datadataList = await this.$api.get(global.apiUrls.post66f526b296436, {
					teaching_id: this.teachin
				});

				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data
				this.getia708e2d8a545eFunc()
			},
			//APP接口-查询主题讨论记录
			async getia708e2d8a545eFunc() {
				//请求方法
				//数据验证

				let dataanswerList = await this.$api.get(global.apiUrls.post6708e2d8a545e, {
					teaching_id: this.teachin
				});

				if (dataanswerList.data.code != 1) {
					this.$message.info(dataanswerList.data.msg);
					return
				}
				let infoanswerList = dataanswerList.data;
				this.answerList = infoanswerList.data

			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.talk_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.talk_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.talk_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.talk_fd0_0_c0 {
		width: 120rpx;
	}

	.talk_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.talk_flex_1 {
		padding: 24rpx;
	}

	.talk_fd1_0_c1_c0 {
		color: rgba(102, 102, 102, 1);
		line-height: 48rpx;
		font-size: 24rpx;
	}

	.talk_fd1_0_c1 {
		background: #f3f6f8;
		margin: 24rpx 0rpx 0rpx 0rpx;
		background-size: 100% auto;
		border-radius: 16rpx;
		padding: 24rpx;
	}

	.talk_fd1_0_c0_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.talk_fd1_0 {
		background: var(--benbenbgColor1);
		margin: 0rpx 0rpx 24rpx 0rpx;
		padding: 32rpx 24rpx 32rpx 24rpx;
		background-size: 100% auto;
		border-radius: 24rpx;
	}

	//
	.fd0_0_ben {
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}
</style>